package com.yckj.day02;

import java.util.Scanner;

/**
 * TODO if...else
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/17 14:42
 */
public class IfElseDemo1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入年龄：");
        short age = scan.nextShort();
        // 合法性判断
        if(age <= 0 || age > 150){
            System.out.println("年龄不符合要求");
            return; // 结束方法
        }
        if(age < 18){
            System.out.println("是未成年人");
        }else{
            System.out.println("是成年人");
        }
        scan.close();
    }
}
